<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>std</title>
<style type="text/css">
	.circle{
		width: 100px;
		height: 100px;
		background-color: yellow;
		box-shadow: 10px 10px 30px rgba(0,0,0,.5);
		<!-- border-radius: 50px; -->
	}
</style>
<script type="text/javascript">
	// 检查并获取对象中所有属性
	var obj = new Object();
	obj.name = "孙悟空";
	console.log("name" in obj);
	for (var n in obj) {
		console.log("属性名："+n)
	}
	
	// 立即执行函数
	(function(a, b) {
	  console.log(a+b);
	})(1, 2);
	
	// 原型prototype
	function Person(){
	}
	Person.prototype.version = "1.0.0";

	var obj = new Person();
	console.log(obj.version)
	// obj.hasOwnProperty(var) 该方法只检查当前对象自身中属性，不包含原型中已有属性
	console.log(obj.hasOwnProperty("name"))
	
	
	// toString()重写Object对象的原型方法
	function User(){
	}
	
	var user = new User();
	user.name = "习大大";
	user.position = "主席"
	
	User.prototype.toString = function(){ // 从原型更改所有User类实例的toString()都更改
		return "User[name=" + this.name + ",position=" + this.position + "]";
	}
	console.log(user.toString())
	
	// 经典数组去重
	var arr = [1,2,2,2,3,2,1,4,5]
	for(var i=0; i<arr.length; i++) {
		for(var j=i+1; j<arr.length; j++) {
			if(arr[i] == arr[j]) {
				arr.splice(j, 1);
				j--; // 处理出现连续重复值
			}
		}
	}
	console.log(arr)
	
	
	// 函数对象的2个方法call()&apply()
	function cal(var1, var2){
		console.log(this)
	}

	var obj = new Object();
	obj.name = "函数对象";
	<!-- cal.call(obj, 1, 2); -->
	cal.apply(obj, [1, 2]);
	
	// argument 
	function calArg(){
		console.log(arguments[0])
		console.log(arguments[1])
		console.log(arguments.callee) // callee=函数对象
	}
	
	calArg("猪八戒", 88);
	
	debugger
	var ua = navigator.userAgent;
	if(/firefox/i.test(ua)){
		console.log("Firefox浏览器")
	}else if(/chrome/i.test(ua){
		console.log("Chrome浏览器")
	}else if(/msie/i.test(ua)){
		console.log("IE浏览器")
	}else if("ActiveXObject" in window){
		console.log("你是IE11, 枪毙~~~")
	}
	
	
</script>
</head>


<body>
	<div>
		<div class="circle"></div>
		<!--<img src="img/outline.png" />-->
	</div>
</body>
</html>